// _compoments/luckDrawItemView/luckDrawItemView.js
const app = getApp();
var mfApi = require('../../api/api.js');

Component({
    /**
     * 组件的属性列表
     */
    properties: {
        itemData: {
            type: Object,
            value: {}
        },
    },

    /**
     * 组件的初始数据
     */
    data: {
        baseUrl: app.globalData.baseUrl
    },

    /**
     * 组件的方法列表
     */
    methods: {
        onBtnClick() {
            // 抽奖
            if(this.data.itemData.userAwardStatus == "0") {
                this.triggerEvent("toLuckDraw", this.data.itemData.resourceType);
            } else if(this.data.itemData.userAwardStatus == "2") {
                this.triggerEvent("toShowLuckDraw", this.data.itemData.id);
            }
        },

        // async luckDrawApi() {
        //     let res = await mfApi.http(mfApi.draw(app.globalData.openId, this.data.itemData.resourceType), "GET", {});
        // }
        // 
    }
})
